import axios from '@/plugins/axios'

// 状态统计
export async function countByStatus (params) { // 状态统计 *****
  try {
    let res = await axios.get(`/resume/statusList`, params)
    return res.data
  } catch (err) {
    console.log(err)
    return err.response.data
  }
}
//  查询候选人列表显示设置
export async function applicationShowConfig (params) { // 查询候选人列表显示设置 ******
  try {
    let res = await axios.get(`/static/resume/columns.json`, params)
    return res.data
  } catch (err) {
    console.log(err)
    return err.response.data
  }
}

// 获取数据信息
export async function recommendQueryConditions (params) { // 获取数据信息 ******
  try {
    let res = await axios.get(`/static/resume/searchConditions.json`, params)
    return res.data
  } catch (err) {
    return err.response.data
  }
}
// 简历列表
export async function applicationList (params) { // 获取简历列表 *****
  try {
    let res = await axios.post(`/resume/resumeList`, params)
    return res.data
  } catch (err) {
    console.log(err)
    return err.response.data
  }
}
// 简历详细信息
export async function resumeInfo (params) { // 简历详细信息 ******
  try {
    let res = await axios.post(`/resume/resumeInfo`, params)
    return res.data
  } catch (err) {
    return err.response.data
  }
}

// 保存简历
export async function saveResume (params) {
  try {
    let res = await axios.post(`/resume/create`, params) // 创建简历和修改 ******
    return res.data
  } catch (err) {
    return err.response.data
  }
}
// 推荐
export async function recommend (params) { // 创建简历和修改 ******
  try {
    let res = await axios.post(`/resume/create`, params)
    return res.data
  } catch (err) {
    return err.response.data
  }
}
// 修改推荐
export async function updateRecommendInfo (params) { // 创建简历和修改 ******
  try {
    let res = await axios.post(`/resume/create`, params)
    return res.data
  } catch (err) {
    return err.response.data
  }
}
// 获取模板
export async function findTemplate (params) {
  try {
    let res = await axios.get(`/static/resume/resumeTemplate.json`, params) // 获取模板 ******
    return res.data
  } catch (err) {
    return err.response.data
  }
}
// 改变候选人状态  合适、不合适、待定、取消待定、删除
export async function applicationOperator (params) { // 改变候选人状态  合适、不合适、待定、取消待定、删除 ******
  try {
    let res = await axios.post(`/resume/changeStatus`, params)
    return res.data
  } catch (err) {
    console.log(err)
    return err.response.data
  }
}
// 职位各状态数据统计
export async function analyResult (params) {
  try {
    let res = await axios.post(`/jobboard/jobboardcandidates/hunter/analyResult`, params)
    return res.data
  } catch (err) {
    console.log(err)
    return err.response.data
  }
}
// 职位各状态数据统计
export async function deleteAnalyResult (params) {
  try {
    let res = await axios.post(`/jobboard/jobboardcandidates/hunter/deleteAnalyResult`, params)
    return res.data
  } catch (err) {
    console.log(err)
    return err.response.data
  }
}
// 查询简历单个数据
export async function findApplicationById (params) {
  try {
    let res = await axios.post(`/jobboard/applications/application/findApplicationById`, params)
    return res.data
  } catch (err) {
    console.log(err)
    return err.response.data
  }
}
// 获取候选人模板
export async function applicationTemplate (params) {
  try {
    let res = await axios.post(`/jobboard/applications/application/applicationTemplate`, params)
    return res.data
  } catch (err) {
    console.log(err)
    return err.response.data
  }
}
// 保存用户候选人显示设置
export async function addOrModifyShowConfig (params) {
  try {
    let res = await axios.post(`/jobboard/applications/application/addOrModifyShowConfig`, params)
    return res.data
  } catch (err) {
    console.log(err)
    return err.response.data
  }
}
// 删除候选人
export async function delApplication (params) {
  try {
    let res = await axios.post(`/jobboard/applications/application/delApplication`, params)
    return res.data
  } catch (err) {
    console.log(err)
    return err.response.data
  }
}
// 获取简历创建和更新时间
export async function resumeData (params) {
  try {
    let res = await axios.post(`/jobboard/jobboardcandidates/candidate/resumeData?userId=${params.id}`)
    return res.data
  } catch (err) {
    console.log(err)
    return err.response.data
  }
}
// 获取简历创建和更新时间
export async function findPositionByApplication (params) {
  try {
    let res = await axios.post(`/jobboard/applications/application/findPositionByApplication`, params)
    return res.data
  } catch (err) {
    console.log(err)
    return err.response.data
  }
}
// 状态统计
export async function sendApplicationMail (params) {
  try {
    let res = await axios.post(`/jobboard/jobboardcandidates/candidate/sendApplicationMail`, params)
    return res.data
  } catch (err) {
    console.log(err)
    return err.response.data
  }
}
// 获取数据信息
export async function applicationBaseInfo (params) {
  try {
    let res = await axios.post(`/jobboard/applications/application/applicationBaseInfo`, params)
    return res.data
  } catch (err) {
    return err.response.data
  }
}
// --------------------推荐简历
// 上传简历
export async function uploadResume (params) {
  try {
    let res = await axios.post(`/jobboard/jobboardcandidates/hunter/upload`, params)
    return res.data
  } catch (err) {
    return err.response.data
  }
}
// 拆分文件
export async function fileSave (params) {
  try {
    let res = await axios.post(`/jobboard/jobboardcandidates/hunter/fileSave`, params)
    return res.data
  } catch (err) {
    return err.response && err.response.data
  }
}
// 批量保存简历
export async function batchFileSave (params) {
  try {
    let res = await axios.post(`/jobboard/jobboardcandidates/hunter/batchFileSave`, params)
    return res.data
  } catch (err) {
    return err.response.data
  }
}
// 查重
export async function resumeCheckConfig (params) {
  try {
    let res = await axios.post(`/jobboard/jobboardcandidates/hunter/resumeCheckConfig`, params)
    return res.data
  } catch (err) {
    return err.response.data
  }
}
// 查重
export async function resumeCheck (params) {
  try {
    let res = await axios.post(`/jobboard/jobboardcandidates/hunter/resumeCheck`, params)
    return res.data
  } catch (err) {
    return err.response && err.response.data
  }
}
// 获取推荐报告模板
export async function recommendReasonTemplate (params) {
  try {
    let res = await axios.post(`/jobboard/jobboardcandidates/hunter/recommendReasonTemplate`, params)
    return res.data
  } catch (err) {
    return err.response.data
  }
}
// --------------------猎头简历详情信息
// // 查询简历附件
// export async function showORCView (params) {
//   try {
//     let res = await axios.post(`/jobboard/jobboardcandidates/hunter/showORCView`, params)
//     return res.data
//   } catch (err) {
//     return err.response.data
//   }
// }
// 查询简历附件
export async function findAttachments (params) {
  try {
    let res = await axios.post(`/jobboard/jobboardcandidates/hunter/findAttachments`, params)
    return res.data
  } catch (err) {
    return err.response.data
  }
}
// 上传附件 // 可能需要再组件中做
export async function uploadFile (params) {
  try {
    let res = await axios.post(`/jobboard/jobboardcandidates/hunter/uploadFile`, params)
    return res.data
  } catch (err) {
    return err.response.data
  }
}
// 删除附件
export async function deleteAttachment (params) {
  try {
    let res = await axios.post(`/jobboard/jobboardcandidates/hunter/deleteAttachment`, params)
    return res.data
  } catch (err) {
    return err.response.data
  }
}
// 上传头像
export async function photoUpload (params) {
  try {
    let res = await axios.post(`/jobboard/jobboardcandidates/hunter/photoUpload`, params)
    return res.data
  } catch (err) {
    return err.response.data
  }
}
// 推荐信息
export async function recommendInfo (params) {
  try {
    let res = await axios.post(`/jobboard/jobboardcandidates/hunter/recommendInfo`, params)
    return res.data
  } catch (err) {
    return err.response.data
  }
}
// 职位信息
export async function positionInfo (params) {
  try {
    let res = await axios.post(`/jobboard/jobboardcandidates/hunter/positionInfo`, params)
    return res.data
  } catch (err) {
    return err.response.data
  }
}
//  获取消息列表
export async function messageList (params) {
  try {
    let res = await axios.post(`/jobboard/jobboardcandidates/message/list`, params)
    return res.data
  } catch (err) {
    return err.response.data
  }
}
// 发送消息给职位负责人
export async function sendToPositionTeamHr (params) {
  try {
    let res = await axios.post(`/jobboard/jobboardcandidates/message/sendToPositionTeamHr`, params)
    return res.data
  } catch (err) {
    return err.response.data
  }
}
// 猎头回复消息
export async function replyToPositionTeamHr (params) {
  try {
    let res = await axios.post(`/jobboard/jobboardcandidates/message/reply`, params)
    return res.data
  } catch (err) {
    return err.response.data
  }
}
// 删除消息
export async function deleteMsg (params) {
  try {
    let res = await axios.post(`/jobboard/jobboardcandidates/message/delete`, params)
    return res.data
  } catch (err) {
    return err.response.data
  }
}
// 删除消息
export async function readMsg (params) {
  try {
    let res = await axios.post(`/jobboard/jobboardcandidates/message/read`, params)
    return res.data
  } catch (err) {
    return err.response.data
  }
}
// 军工简历信息
export async function candidateResume (params) {
  try {
    let res = await axios.post(`/jobboard/jobboardcandidates/candidate/candidateResume`, params)
    return res.data
  } catch (err) {
    return err.response.data
  }
}
// 军工模板
export async function resumeTemplate (params) {
  try {
    let res = await axios.post(`/jobboard/jobboardcandidates/candidate/resumeTemplate`, params)
    return res.data
  } catch (err) {
    return err.response.data
  }
}
// 军工查询简历附件
export async function candidatefindAttachments (params) {
  try {
    let res = await axios.post(`/jobboard/jobboardcandidates/candidate/findAttachments`, params)
    return res.data
  } catch (err) {
    return err.response.data
  }
}
// 删除附件
export async function candidatedeleteAttachment (params) {
  try {
    let res = await axios.post(`/jobboard/jobboardcandidates/candidate/deleteAttachment`, params)
    return res.data
  } catch (err) {
    return err.response.data
  }
}
